package com.fable.biz.operate.impl;

import com.fable.biz.operate.AdminRoleService;
import com.fable.dal.mapper.ext.AdminRoleExtMapper;
import com.fable.dal.model.AdminRoleDO;
import com.fable.dal.model.AdminRoleQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * Created by weishuai on 18/7/19.
 */
@Service("adminRoleService")
public class AdminRoleServiceImpl implements AdminRoleService {

    @Autowired
    AdminRoleExtMapper adminRoleExtMapper;

    @Override
    public int add(AdminRoleDO record) {
        record.setGmtModified(new Date());
        record.setGmtCreate(new Date());
        return adminRoleExtMapper.insertSelective(record);
    }

    @Override
    public void update(AdminRoleDO record) {
        record.setGmtModified(new Date());
        adminRoleExtMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int add1(AdminRoleDO record) {
        return 0;
    }

    @Override
    public List<AdminRoleDO> selectByQuery(AdminRoleQuery query) {
        return adminRoleExtMapper.selectByQuery(query);
    }

    @Override
    public AdminRoleDO selectByPrimaryKey(Integer id) {
        return adminRoleExtMapper.selectByPrimaryKey(id);
    }
}
